package compare

import (
	"awesomeProject2/download"
	"awesomeProject2/mt"
	"awesomeProject2/time"
	"awesomeProject2/write_line"
	"fmt"
	"strconv"
	"strings"
)

func CompareNewProduct() {

	products := mt.GetFileMtNewProducts()
	cplines := make([]string, 0)
	secound := time.GetTimeSecound()
	for _, product := range products {
		for _, productSpu := range product.Data.ProductSpuList {
			println(productSpu.Name)
			if strings.Contains(productSpu.Name, "抱抱") {
				download.Download(productSpu.Picture, productSpu.Name)
				s := productSpu.Skus[0]
				//商品条形码(upc/ean等)	商品名称	规格名称	价格（元）	库存	商品三级类目名称*	商品品牌	产地	重量	重量单位	店内码/货号	店内一级分类	店内二级分类	货架码/位置码	起购数	售卖状态	商品卖点	描述	可售时间	预售的可配送时间	商品属性	app_food_code
				//
				code := strconv.Itoa(secound)
				secound = secound + 1
				sprintf := fmt.Sprintf("%s#%s#%s#%.2f#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s", "m", productSpu.Name, "m", s.OriginPrice, "0", "m", "m", "m", "100", "g", code, "m", "m", "m", "1", "m", "m", "m")
				cplines = append(cplines, sprintf)

				//sprintf := fmt.Sprintf("%s#%s#%s#%s#%s#%s#%s#%s#%.2f#%s#%s#%.2f", "m", productSpu.Name, "m", "100", "g", "m", "m", "m", s.OriginPrice, "0", "1", s.Price)
				//cplines = append(cplines, sprintf)
			}
		}
	}
	write_line.WriteLineTxm(cplines, "C:\\Users\\admin\\GolandProjects\\waimaigo\\mt\\cp_new_products_mt.txt")
}
